var loginTips = $('#loginTips');

$('#contentSubmit').click(function () {

    var content = $('#content').val();
    if(content == '' || content == null) {
        showTips('请输入点评内容');
        return false;
    }
    if(content.length > 500) {
        showTips('内容不能大于500个字哦');
        return false;
    }
    hideTips();
    var artid = $('#artid').val();
    var param = {content:content,artid:artid}

    $.ajax({
        url:"/comment/add",
        type:"post",
        data:param,
        success:function(data){

            if(data.code == 0) {
                window.location.reload();
            }else {
                showTips(data.msg);
            }
        }
    });
})

function showTips(msg) {
    loginTips.show();
    loginTips.text(msg);
}
function hideTips() {
    loginTips.text('');
    loginTips.hide();
}

$('#loginBtn').click(function () {
    window.location.href='/user/toLogin';
})
var id = $('#artid').val();
$.post('/blog/upBlogViewCount',{id:id})
